package com.qf.day10;

import java.util.Objects;

public class Dog {
    private String name;
    private String type;
    private int age;

    public Dog() {
    }

    public Dog(String name, String type, int age) {
        this.name = name;
        this.type = type;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public boolean equals(Object obj) {
        if(this==obj){
            return true;
        }
        if(obj ==null || getClass() !=obj.getClass()){
            return false;
        }
        Dog dog = (Dog) obj;
        return age == dog.age && Objects.equals(name,dog.name);
    }
    //

    @Override
    public int hashCode() {
        return Objects.hash(name,age);
    }
}
